package com.ssfGame.puremvc.view.application
{	
	
	
	import com.ssfGame.puremvc.StaticConst;
	import com.ssfGame.puremvc.view.vc.TipLayerVC;
	
	import flash.display.DisplayObject;
	
	import org.puremvc.as3.interfaces.INotification;
	import org.puremvc.as3.patterns.mediator.Mediator;
	
	/**
	 * 
	 * @author chery
	 */
	public class TipLayerMediator extends Mediator
	{
		public static const NAME:String="tipLayerMediator";

		public function TipLayerMediator(mediatorName:String=null, viewComponent:Object=null)
		{
			super(mediatorName, viewComponent);
		}
		override public function listNotificationInterests():Array
		{
			return [
				StaticConst.N_M_TIP_LAYER_ADD,
				StaticConst.N_M_TIP_LAYER_DEL
			]
		}
		override public function handleNotification(notification:INotification):void
		{
			var disObj:DisplayObject=notification.getBody() as DisplayObject;
			
			if (disObj==null)
				return;
			
			switch(notification.getName())
			{
				case StaticConst.N_M_TIP_LAYER_ADD:
					
					if(!tipLayerVC.contains(disObj))
						tipLayerVC.addChild(disObj);
					
					break;
				case StaticConst.N_M_TIP_LAYER_DEL:
					
					if(tipLayerVC.contains(disObj))
						tipLayerVC.removeChild(disObj);
					
					break;
			}
		}
		public function get tipLayerVC():TipLayerVC
		{
			return viewComponent as TipLayerVC;
		}
	}
}